﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SteamFluentAPI.Infrastructure.MetaData
{
    /// <summary>
    /// Base class used to capture interface, method and parameter meta data.
    /// </summary>
    public class SteamMetaData
    {
        public string Name { get; set; }
        public bool IsImplemented { get; set; }
    }

    /// <summary>
    /// Parameters used to capture steam interface meta data.
    /// </summary>
    public class SteamInterfaceMetaData : SteamMetaData
    {
        public SteamInterfaceMetaData()
        {
            this.Methods = new List<SteamMethodMetaData>();
        }
        public string ActualInterfaceName { get; set; }
        public SteamGameType SteamGameType { get; set; }
        public bool RequiresGameType { get; set; }
        public List<SteamMethodMetaData> Methods { get; set; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Name: " + Name);
            sb.AppendLine("Actual Name: " + ActualInterfaceName);
            sb.AppendLine("Game Type: " + SteamGameType.ToString());
            sb.AppendLine("Requires Game Type: " + RequiresGameType);
            sb.AppendLine("Implemented: " + IsImplemented);
            return sb.ToString();
        }
    }

    /// <summary>
    /// Parameters used to capture steam method meta data.
    /// </summary>
    public class SteamMethodMetaData : SteamMetaData
    {
        public SteamMethodMetaData()
        {
            this.Parameters = new List<SteamParameterMetaData>();
        }

        public SteamInterfaceMetaData Interface { get; set; }
        public string ActualMethodName { get; set; }
        public string VersionCode { get; set; }
        public List<SteamParameterMetaData> Parameters { get; set; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Name: " + Name);
            sb.AppendLine("Actual Name: " + ActualMethodName);
            sb.AppendLine("Version: " + VersionCode);
            sb.AppendLine("Belongs to Interface: " + Interface.Name);
            sb.AppendLine("Implemented: " + IsImplemented);
            return sb.ToString();
        }
    }

    /// <summary>
    /// Parameters used to capture steam parameter meta data.
    /// </summary>
    public class SteamParameterMetaData : SteamMetaData
    {
        public SteamMetaData Method { get; set; }
        public bool IsRequired { get; set; }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Name: " + Name);
            sb.AppendLine("Required: " + IsRequired);
            sb.AppendLine("Belongs to Method: " + Method.Name);
            sb.AppendLine("Implemented: " + IsImplemented);
            return sb.ToString();
        }
    }
}
